package com.example;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@SpringBootApplication
public class Boot3ThymeleafApplication {

	public static void main(String[] args) {
		SpringApplication.run(Boot3ThymeleafApplication.class, args);
	}
	
	@RequestMapping("/index")
	public String index(Model model){
	    List<User> users=new ArrayList<User>();
	    User user1=new User("111",1);
	    User user2=new User("222",2);
	    User user3=new User("333",3);
	    users.add(user1);
	    users.add(user2);
	    users.add(user3);
	    model.addAttribute("users", users);
		return "index";
	}
}
